package net.lab1024.sa.admin.module.business.exam.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import net.lab1024.sa.admin.module.business.exam.domain.form.add.CourseaAddForm;
import net.lab1024.sa.admin.module.business.exam.domain.form.query.CourseaQueryForm;
import net.lab1024.sa.admin.module.business.exam.domain.form.update.CourseaUpdateForm;
import net.lab1024.sa.admin.module.business.exam.domain.vo.CourseaVO;
import net.lab1024.sa.admin.module.business.exam.service.CourseaService;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 生产订单与机器对应表 Controller
 *
 * @Author AKITA
 * @Date 2025-05-22 15:29:15
 * @Copyright AKITA
 */

@RestController
@Tag(name = "生产订单与机器对应表")
public class CourseaController {

    @Resource
    private CourseaService courseaService;

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/coursea/queryPage")

    public ResponseDTO<PageResult<CourseaVO>> queryPage(@RequestBody @Valid CourseaQueryForm queryForm) {
        return ResponseDTO.ok(courseaService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author AKITA")
    @PostMapping("/coursea/add")

    public ResponseDTO<String> add(@RequestBody @Valid CourseaAddForm addForm) {
        return courseaService.add(addForm);
    }

    @Operation(summary = "更新 @author AKITA")
    @PostMapping("/coursea/update")

    public ResponseDTO<String> update(@RequestBody @Valid CourseaUpdateForm updateForm) {
        return courseaService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    @PostMapping("/coursea/batchDelete")

    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return courseaService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/coursea/delete/{docEntry}")

    public ResponseDTO<String> batchDelete(@PathVariable Long docEntry) {
        return courseaService.delete(docEntry);
    }
}
